#include<stdio.h>
#include<math.h>
#include<string.h>
#define N 2005
char a[1005][N],t1[N];
char b[1005][N],t2[N];
int count;
void find(char s1[N][N],char s2[N][N],int m)
{
	int i,j;
	for(i=0;i<m;i++)
		for(j=0;s2[j][0]!='\0';j++)
		{
			if(!strcmp(s1[i],s2[j]))
			{
				strcpy(s2[j],"233");
				count++;
				break;
			}
		}
	return;
}
int main()
{
	int i1=0,j1=0,i2=0,j2=0,i,max=0;
	double ans;
	char temp;
	gets(t1);
	gets(t2);
	for(i=0;t1[i]!='\0';i++)
	{
		if(t1[i]==' ')
		{
			a[i1][j1]='\0';
			i1++;j1=0;continue;
		}
		if(t1[i]<'a')	t1[i]+='a'-'A';
		a[i1][j1++]=t1[i];
	}
	for(i=0;t2[i]!='\0';i++)
	{
		if(t2[i]==' ')
		{
			b[i2][j2]='\0';
			i2++;j2=0;continue;
		}
		if(t2[i]<'a')	t2[i]+='a'-'A';
		b[i2][j2++]=t2[i];
	}
	max=(i1>i2?i1:i2)+1; 
	count=0;
	if(i1>i2)
		find(a,b,max);
	else
		find(b,a,max);
	ans=(count)/(sqrt((double)count))/(sqrt((double)max));
	if(ans>0.9)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}
